@extends('admin/layout.app')

@section('title', '用户编辑')

@section('content')
    @if (count($errors) > 0)
        <div class="col-lg-9">
            <div class="alert alert-danger">
                <ul>
                    @if(is_object($errors))
                        @foreach($errors->all() as $error)
                            <li>{{$error}}</li>
                        @endforeach
                    @else
                        <li>{{$errors}}</li>
                    @endif
                </ul>
            </div>
        </div>
    @endif
    <div class="col-lg-10">
        <form class="form-horizontal" action="/admin/user" method="post">
            {{csrf_field()}}
            <div class="form-group">
                <label for="inputEmail3" class="col-sm-2 control-label">用户名</label>
                <div class="col-sm-8">
                    <input type="text" name="name" class="form-control" id="inputEmail3" placeholder="用户名">
                </div>
            </div>
            <div class="form-group">
                <label for="inputPassword3" class="col-sm-2 control-label">密码</label>
                <div class="col-sm-8">
                    <input type="password" name="password" class="form-control" id="inputPassword3" placeholder="密码">
                </div>
            </div>
            <div class="form-group">
                <label for="inputPassword4" class="col-sm-2 control-label">昵称</label>
                <div class="col-sm-8">
                    <input type="text" name="nickname" class="form-control" id="inputPassword4" placeholder="昵称">
                </div>
            </div>
            <div class="form-group">
                <label for="inputPassword5" class="col-sm-2 control-label">邮箱</label>
                <div class="col-sm-8">
                    <input type="text" name="email" class="form-control" id="inputPassword5" placeholder="邮箱">
                </div>
            </div>
            <div class="form-group">
                <label for="input-status" class="col-sm-2 control-label">状态</label>
                <div class="col-sm-8">
                    <p class="pt6pr12">
                        <input id="input-status-1" type="radio" name="status"
                               value="1" checked/> <label
                                for="input-status-1">正常</label>
                        <input id="input-status-2" type="radio" name="status"
                               value="2"/> <label
                                for="input-status-2">禁用</label>
                    </p>
                </div>
            </div>
            <div class="form-group">
                <label for="inputPassword6" class="col-sm-2 control-label">职位</label>
                <div class="col-sm-8">
                    <p class="pt6pr12">
                        @if($role_list)
                            @foreach($role_list as $item)
                                @if( $item['id'] != env('ADMINISTRATOR_ROLE_ID') || $current_user['is_admin'])
                                    <label><input type="checkbox" name="menu_ids[]"
                                                  value="{{$item['id']}}"/>{{$item['name']}}</label>
                                @endif
                            @endforeach
                        @endif
                    </p>
                </div>
            </div>
            <div class="form-group">
                <div class="col-sm-offset-3 col-sm-10">
                    <button type="submit" class="btn btn-default">保存</button>
                </div>
            </div>
        </form>
    </div>
@endsection
